import request, {requestString} from '../../utils/request'

/**
 * 保存费用
 *
 * @param chargeForm
 * @param bindingResult
 * @return
 */
export async function createOdCharge(data) {
    return request(apiPath.mc + "/api/odCharge", {
        method: 'post',
        data
    });
}

/**
 * 更新费用
 *
 * @param chargeForm
 * @param bindingResult
 * @return
 */
export async function updateOdCharge(data) {
    return request(apiPath.mc + "/api/odCharge", {
        method: 'put',
        data
    });
}

/**
 * 根据id删除订单费用
 *
 * @param id
 * @return
 */
export async function deleteOdChargeById({ id }) {
    return request(apiPath.mc + "/api/odCharge/" + id, {
        method: 'delete'
    });
}


/**
 * 根据id获取费用
 *
 * @param id
 * @return
 */
export async function getOdChargeById({ id }) {
    return request(apiPath.mc + "/api/odCharge/" + id, {
        method: 'get'
    });
}

/**
 * 费用变更审核
 *
 * @param id
 * @return
 */
export async function approval(data) {
    return request(apiPath.mc + "/api/odCharge/" + data.id + "/approval", {
        method: 'put',
        data
    });
}

/**
 *计算费用金额
 *
 * @param data
 */
export async function totalMoney(data) {
    return requestString(apiPath.mc + "/api/odCharge/totalMoney", {
        method: 'post',
        data
    });
}

/**
 * 	可批量对冲费用分页查询
 * 
 * @param orderNo			订单号
 * @param settlementUnit	结算单位
 * @param beginDate			接单开始日期
 * @param endDate			接单截至日期
 * @param lesseeCode		租户编码
 * @param page				分页对象
 * @return
 */
export async function queryChargesForPage(data) {
    return request(apiPath.mc + "/api/odCharge", {
        method: 'get',
        data
    });
}


/**
 * 选择模板批量新增费用
 * @param data
 * @returns {Promise.<void>}
 */
export async function batchCreate(data) {
    return request(apiPath.mc + "/api/odCharge/template", {
        method: 'post',
        data
    });
}
